<%@ page language="java" contentType="text/html; charset=utf-8"  pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>

<div id="page-content" class="page-content">
		<div class="panel panel-default oparePanel">
			<div class="panel-body">
				<div class="searchBox">
				<%-- <input type="text" id="searchStr" name="searchStr"  placeholder="按机构名称搜索" class="input_search" />
				<input type="submit"  class="btn_search" onclick="corp.search('searchStr');"/>--%>
				</div>
		
				<div class="opare">
					<input type="button"  value="+" class="btn_add" onclick="menuUrl('corp/view', 'corp:add');" />
				</div>
		
			</div>
		</div>
		
		<div class="portlet-body">
			<div class="table-scrollable">
				
				
			<table class="table tree">
			 
			    <thead class="flip-content">
					<tr>
						<th width="25%">机构名称</th>
						<th width="25%">状态</th>
						<th width="20%">创建时间</th>
						<th width="30%" class="text-center">操作</th>
					</tr>
				</thead>
				<tbody id="select_tbody">
	               <c:set var="index" value="0"></c:set>
	               <c:if test="${result.code eq 'SUCCESS' }">
					     <c:forEach items="${result.data}" var ="root" varStatus="status">
					        <c:set var="index" value="${index + 1 }"></c:set>
					        <c:set var="parent" value="${index }"></c:set>
					        <tr class="treegrid-${index}">
								
								<td width="25%" class="">${root.name }</td>
								<c:choose>  
								   <c:when test="${root.status eq '0'}"> 
								     <td width="25%" class="">待审批</td>
								   </c:when>  
								   <c:when test="${root.status eq '1'}"> 
								     <td width="25%" class="">正常</td>
								   </c:when>  
								   <c:when test="${root.status eq '2'}"> 
								     <td width="25%" class="">注销</td>
								   </c:when>  
								</c:choose>  
								<td width="20%" class=""><fmt:formatDate value="${root.createTime }" pattern="yyyy-MM-dd HH:mm:ss" /></td>
								<td width="30%" class="text-center">
								 
								 <c:choose>
								   <c:when test="${root.isDeleteCorp eq 0 and root.isDelete eq 0 }">  
								   <a href="javascript:;" onclick="corp.dele('${root.id}');" class="a-delet ">删除</a>
								   </c:when>
								   <c:otherwise> 
								   <a href="javascript:;"  class="a-delet disabled" >删除</a>
								   </c:otherwise>
								</c:choose>							 
								 
								<c:choose>  
									<c:when test="${root.status eq '1'}"> 
									<a href="javascript:;" onclick="updateShow('corp/view', 'corp:modify','${root.id}');" class="a-modefiy">修改</a>
								   
								   </c:when> 
								   <c:otherwise> 
									    <a href="javascript:;"  class="a-delet disabled">修改</a>
									</c:otherwise>
								</c:choose> 
									<a href="javascript:;" onclick="detailShow('corp/view', 'corp:detail','${root.id}');" class="a-detial">详情</a>
								</td>
			                </tr>
					        <c:if test="${! empty root.childList }">
					    		 <c:forEach items="${root.childList}" var ="second" varStatus="statusSecond">
					    		     
					    		     <c:set var="index" value="${index + 1 }"></c:set>
					    		     <c:set var="subParent" value="${index }"></c:set>						    		     
					    		     <tr class="treegrid-${index} treegrid-parent-${parent }">
									
										<td width="25%" class="">${second.name }</td>
										<c:choose>  
										   <c:when test="${second.status eq '0'}"> 
										     <td width="25%" class="">待审批</td>
										   </c:when>  
										   <c:when test="${second.status eq '1'}"> 
										     <td width="25%" class="">正常</td>
										   </c:when>  
										   <c:when test="${second.status eq '2'}"> 
										     <td width="25%" class="">注销</td>
										   </c:when>  
										</c:choose>  
										<td width="20%" class=""><fmt:formatDate value="${second.createTime }" pattern="yyyy-MM-dd HH:mm:ss" /></td>
										<td width="30%" class="text-center">
										 
										 <c:choose>
										   <c:when test="${second.isDeleteCorp eq 0 and second.isDelete eq 0 }">  
										  	 <a href="javascript:;" onclick="corp.dele('${second.id}');" class="a-delet ">删除</a>
										   </c:when>
										   <c:otherwise> 
										   	<a href="javascript:;"  class="a-delet disabled" >删除</a>
										   </c:otherwise>
										</c:choose>							 
										 
										<c:choose>  
											<c:when test="${second.status eq '1'}"> 
												<a href="javascript:;" onclick="updateShow('corp/view', 'corp:modify','${second.id}');" class="a-modefiy">修改</a>
										   </c:when> 
										   <c:otherwise> 
											    <a href="javascript:;"  class="a-delet disabled">修改</a>
											</c:otherwise>
										</c:choose> 
											<a href="javascript:;" onclick="detailShow('corp/view', 'corp:detail','${second.id}');" class="a-detial">详情</a>
										</td>
									</tr>
									
								   	<c:if test="${! empty second.childList }">
						    		 <c:forEach items="${second.childList}" var ="three" varStatus="statusthree">
						    		        
						    		    <c:set var="index" value="${index + 1 }"></c:set>
						    		    <tr class="treegrid-${index} treegrid-parent-${subParent }">
										
											<td width="25%" class="">${three.name }</td>
											<c:choose>  
											   <c:when test="${three.status eq '0'}"> 
											     <td width="25%" class="">待审批</td>
											   </c:when>  
											   <c:when test="${three.status eq '1'}"> 
											     <td width="25%" class="">正常</td>
											   </c:when>  
											   <c:when test="${three.status eq '2'}"> 
											     <td width="25%" class="">注销</td>
											   </c:when>  
											</c:choose>  
											<td width="20%" class=""><fmt:formatDate value="${three.createTime }" pattern="yyyy-MM-dd HH:mm:ss" /></td>
											<td width="30%" class="text-center">
											 
											 <c:choose>
											   <c:when test="${three.isDeleteCorp eq 0 and three.isDelete eq 0 }">  
											  	 <a href="javascript:;" onclick="corp.dele('${three.id}');" class="a-delet ">删除</a>
											   </c:when>
											   <c:otherwise> 
											   	<a href="javascript:;"  class="a-delet disabled" >删除</a>
											   </c:otherwise>
											</c:choose>							 
											 
											<c:choose>  
												<c:when test="${second.status eq '1'}"> 
													<a href="javascript:;" onclick="updateShow('corp/view', 'corp:modify','${second.id}');" class="a-modefiy">修改</a>
											   </c:when> 
											   <c:otherwise> 
												    <a href="javascript:;"  class="a-delet disabled">修改</a>
												</c:otherwise>
											</c:choose> 
												<a href="javascript:;" onclick="detailShow('corp/view', 'corp:detail','${second.id}');" class="a-detial">详情</a>
											</td>
										</tr>
						    		  </c:forEach>
						        	</c:if>
									
					    		 </c:forEach>
					        </c:if>
					     </c:forEach>
				   </c:if>
	            </tbody>
	          </table> 
			
			</div>
		</div>
</div>
<div class="clearfix"></div>
   <script type="text/javascript">
  
      $('.tree').treegrid();

   </script>